home *** CD-ROM | disk | FTP | other *** search
/ New Perspectives on Computer Concepts / New Perspectives on Computer Concepts.iso / np2010c / page774.pag < prev    next >
Portable Network Graphic  |  2008-10-02  |  50KB  |  817x1045  |  8-bit (256 colors)
Labels: hakham | monitor
OCR: 706 SECTION c CHAPTER 1.2 What activates method? method is activated by a message, which C included as a line of program code that is sometimes referred tr as call. For example Java program, line of code such as compare [Pi zzal P zza2) produces message used to activate or call the compare( method. In the object-oriented world, objects often interact to solve a problem by sending and receiving messages. For example pizza object might receive message asking for the pizza's area or price per square inch How op methods relate to classes? Methods can be defined along with the class they affect The getSquarelnchPrice() method pertains to piz- zas of any shape, so it can be defined as part of the Pizza class To calcu- late the square -inch price, however, it is necessary to know the area of a pi ...